package com.example.application.views.map;

import com.example.application.bean.User;
import com.example.application.views.util.DialogUtil;
import com.vaadin.flow.component.UI;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.example.application.components.leafletmap.LeafletMap;
import com.vaadin.flow.router.Route;
import com.vaadin.flow.router.PageTitle;
import com.example.application.views.main.MainView;
import com.vaadin.flow.component.dependency.CssImport;

@Route(value = "map", layout = MainView.class)
@PageTitle("地图")
@CssImport("./views/地图/地图-view.css")
public class MapView extends VerticalLayout {

    private LeafletMap map = new LeafletMap();

    public MapView() {
        User user = (User) UI.getCurrent().getSession().getAttribute("user");
        if (user == null){

        }else if("门店管理员".equals(user.getIdentity())){
            setSizeFull();
            setPadding(false);
            map.setSizeFull();
            map.setView(55.0, 10.0, 4);
            add(map);
        }else{
            DialogUtil.adminAuthority();
        }
    }
}
